home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-03-21 | 1.7 KB | 77 lines | [TEXT/ALFA] |
- ;
- ; MakeFile -- creates a file and writes some data. Ignores errors.
- ;
-
- *= $300
-
- ; create the file "ABC"
-
- lda #$01 ; setup for 'create'
- sta PARAMS
- lda #<NAME ; low byte of name address
- sta PARAMS+1
- lda #>NAME ; high byte of name address
- sta PARAMS+2
- lda #$C0 ; create command
- sta MLI+3 ; put in table
- jsr MLI ; create the file
-
- ; open the file
-
- lda #$03
- sta PARAMS ; adjust number of parameters, name already set
- lda #$00
- sta PARAMS+3
- lda #$A6
- sta PARAMS+4 ; use file 0
- lda #$C8 ; open command
- sta MLI+3
- jsr MLI ; open the file
-
- ; write to the file
-
- lda #$04
- sta PARAMS
- lda PARAMS+5 ; get reference number returned by open
- sta PARAMS+1 ; and put in for write
- sta REF ; and save for close
- lda #<STRING
- sta PARAMS+2 ; pointer to data
- lda #>STRING
- sta PARAMS+3
- lda #$05 ; number of bytes to write
- sta PARAMS+4
- lda #$00
- sta PARAMS+5
- lda #$CB ; write command
- sta MLI+3
- jsr MLI ; write the data
-
- ; close the file
-
- lda #$01
- sta PARAMS
- lda REF ; put in reference number
- sta PARAMS+1
- lda #$CC ; close command
- sta MLI+3
- jsr MLI ; close the file
- rts ; and end
-
- ; call MLI
-
- MLI jsr $BF00 ; call ProDOS
- .byte $00 ; command number
- .word PARAMS ; address of parameter table
- rts
-
- ; data
-
- NAME .byte 3,"ABC" ; name of the file with length
- STRING .byte "Hello",0 ; data to write
- REF .byte $00 ; ProDOS reference number
- PARAMS .dbyt $0000 ; ProDOS parameter table
- .dbyt $0000
- .dbyt $0000
- .dbyt $0000
-